<template>
<div class="layerRtb layerRtb-threecolumn layerRtb-right">
    <three-title :title="{name:'押金明细'}" :close="false">
        <span tag="i" class="rig_close fr" @click="$parent.$parent.clickFourShow()"></span>
    </three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137">
           <div class="analyItem" v-for="(item,index) in capital" :key="index">
            <p class="analyItemTit tx-center">{{item.sourceName}}</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="cLightGray pr8">单号</span>
                    <span>{{item.orderNo}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">时间</span>
                    <span>{{item.riskTime}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">扣除押金</span>
                    <span>{{item.money}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">类型</span>
                    <span>{{item.depositType}}</span>
                </p>
                <p class="col-md-8">
                    <span class="cLightGray pr8">备注</span>
                    <span>{{item.remark}}</span>
                </p>
            </div>
        </div>
    </div>
   <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
                <p class="col-md-6">
                    <span class="cLightGray pr8">押金</span>
                    <span></span>
                </p>
                <p class="col-md-6">
                    <span class="cLightGray pr8">总计</span>
                    <span>{{count}}</span>
                </p>
            </div>
        </div>
    </div>


</div>
</template>
<script>
import {getPmUserInfoDepositByUid} from '../../../Resources/Api'
import {
    mapGetters
} from 'vuex'
export default {
    data () {
        return {
            capital: []
        }
    },
    created () {
        this.PmUserInfoDepositByuid()
    },
    computed: {
        ...mapGetters(['leftInfo']),
        count () {
            return this.capital.map(item => item.money).reduce((acc, cur) => (cur + acc), 0)
        }
    },
    methods: {
        successUpload (value) {

        },
        PmUserInfoDepositByuid () {
            let _this = this
            _this.capital = []
            getPmUserInfoDepositByUid({
                uid: this.leftInfo.uid
            }).then(result => {
                this.capital = result.data.Body
            }).catch(err => {
                console.log(err)
            })
        }
    },
    watch: {
        leftInfo () {
            this.PmUserInfoDepositByuid()
        }
    }
}
</script>
